<?php
/**
 * @Author: Marte
 * @Date:   2017-08-14 14:43:12
 * @Last Modified by:   Marte
 * @Last Modified time: 2017-08-14 15:19:37
 */
session_start();
    if(!isset($_SESSION['username']))
    {
        echo "<script>location='dl.php';</script>";
    }
    //session储存有登录的用户的username

include "../config_connect.php";


//如果收到action
if(isset($_GET['action']))
{
    $active=$_SESSION['username'];//主动方的用户名
    $passive=$_GET['action'];//被动方的用户名

    $sql = "INSERT INTO follow (active, passive, time)
    VALUES ('$active', '$passive',now())";
    if($_mysql->query($sql)==true)
    {
        echo "<script>window.history.back();</script>";
    }
    else
    {
        echo "fail".$_mysql->error;
    }

}


?>